using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace AiPlatformAdmin.Api.Models
{
    /// <summary>
    /// LLM模型类别
    /// </summary>
    public enum LlmModelCategory
    {
        /// <summary>
        /// 聊天模型
        /// </summary>
        Chat,
        
        /// <summary>
        /// 思考模型
        /// </summary>
        Reasoning
    }

    /// <summary>
    /// LLM模型配置
    /// </summary>
    public class LlmModel : ITenantEntity
    {
        [Key]
        public int Id { get; set; }

        /// <summary>
        /// 模型ID（如：gpt-4、claude-3-opus等）
        /// </summary>
        [Required]
        [MaxLength(100)]
        public string ModelId { get; set; } = string.Empty;

        /// <summary>
        /// 模型显示名称
        /// </summary>
        [Required]
        [MaxLength(100)]
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 模型提供商
        /// </summary>
        [Required]
        [MaxLength(50)]
        public string Provider { get; set; } = string.Empty;

        /// <summary>
        /// 模型类别
        /// </summary>
        [Required]
        public LlmModelCategory Category { get; set; }

        /// <summary>
        /// API端点
        /// </summary>
        [Required]
        [MaxLength(500)]
        public string Endpoint { get; set; } = string.Empty;

        /// <summary>
        /// 访问密钥
        /// </summary>
        [Required]
        [MaxLength(500)]
        public string AccessKey { get; set; } = string.Empty;

        /// <summary>
        /// 模型描述
        /// </summary>
        [MaxLength(500)]
        public string? Description { get; set; }

        /// <summary>
        /// 是否启用
        /// </summary>
        public bool IsEnabled { get; set; } = true;

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedAt { get; set; } = DateTime.UtcNow;

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdatedAt { get; set; }

        /// <summary>
        /// 租户ID
        /// </summary>
        [Required]
        public int TenantId { get; set; }

        /// <summary>
        /// 租户
        /// </summary>
        [ForeignKey("TenantId")]
        public Tenant? Tenant { get; set; }

        /// <summary>
        /// 创建者ID
        /// </summary>
        [Required]
        public int CreatedById { get; set; }

        /// <summary>
        /// 创建者
        /// </summary>
        [ForeignKey("CreatedById")]
        public User? CreatedBy { get; set; }
    }
}

